package com.neborosoft.FlyingDog.logic.database.content.identified;

import com.neborosoft.FlyingDog.logic.database.content.info.WikiInfo;

public class Audio extends ArtCollection{
    public static final int DURATION_COEFFICIENT = 100000;

    private String url;
    transient private String lyrics;
    transient private String albumName;
    transient private Object albumId;
    private String artistName;
    transient private Object artistId;
    transient private WikiInfo trackInfo;
    private int duration;
    transient private float totalListeningDuration = 1;

    private Audio(boolean local) {
        super(local);
    }

    private Audio(boolean local, Object id) {
        super(id, local);
    }

    public static Audio createLocalAudio(Object id){
        return new Audio(true,id);
    }

    public static Audio createInternetAudio(Object id){
        return new Audio(false,id);
    }

    public static Audio createLocalAudio(){
        return new Audio(true);
    }

    public static Audio createInternetAudio(){
        return new Audio(false);
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getLyrics() {
        return lyrics;
    }

    public void setLyrics(String lyrics) {
        this.lyrics = lyrics;
    }

    public String getAlbumName() {
        return albumName;
    }

    public void setAlbumName(String albumName) {
        this.albumName = albumName;
    }

    public String getArtistName() {
        return artistName;
    }

    public void setArtistName(String artistName) {
        this.artistName = artistName;
    }

    public WikiInfo getTrackInfo() {
        return trackInfo;
    }

    public void setTrackInfo(WikiInfo trackInfo) {
        this.trackInfo = trackInfo;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public Object getAlbumId() {
        return albumId;
    }

    public void setAlbumId(Object albumId) {
        this.albumId = albumId;
    }

    public Object getArtistId() {
        return artistId;
    }

    public void setArtistId(Object artistId) {
        this.artistId = artistId;
    }

    public float getTotalListeningDuration() {
        return totalListeningDuration;
    }

    public void setTotalListeningDuration(float totalListeningDuration) {
        this.totalListeningDuration = totalListeningDuration;
    }

    public void addListeningDurationWhilePlayBack(int value) {
        totalListeningDuration += value * DURATION_COEFFICIENT / (float)duration;
    }
}